<template>
    <view class="pub_page pub_bg pub_document pub_header_padding">
        <pub-head headerName="document" :headerConfig="headerConfig"></pub-head>
        <div class="pub_page_scroll page_box">
            <div class="content" v-if="documentInfo != ''" v-html="documentInfo.content"></div>
        </div>
    </view>
</template>

<script>
export default {
    data() {
        return {
            pagescrollTop: 0,
            headerConfig: {
                title: '',//标题栏内容
                left_type: 3,
            },

            documentId: '',
            documentInfo: ''
        };
    },
    onLoad(option) {
        this.documentId = option.id || 0;
        this.getDocumentInfo();
        // #ifndef APP-PLUS
        if (process.env.NODE_ENV != 'development') {
            this.headerConfig.left_type = 0;
        }
        // #endif
    },
    onPageScroll(res) {
        this.pagescrollTop = res.scrollTop;
    },
    methods: {
        async getDocumentInfo() {
            this.$comFun.openLoading();
            const res = await this.$request.get('public/getArchivesInfo', {
                id: this.documentId
            });
            // console.log(res);
            this.$comFun.closeLoading();
            if (res.code == 200 && res.result) {
                this.headerConfig.title = res.result.title;
                this.documentInfo = res.result;
            }
        },
    },
};
</script>

<style lang="scss" scoped>
@import "@/common/css/other.scss";
</style>
